Source for file SC_CustomerList.php
Documentation is available at SC_CustomerList.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2010 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
$masterData = new SC_DB_MasterData_Ex();
$arrMobileDomain = $masterData->getMasterData("mtb_mobile_domain");
$objDb = new SC_Helper_DB_Ex();
$this->setWhere("status = 2 AND del_flg = 0 ");
$regdate_col = 'dtb_customer.update_date';
if($mode == "customer") {
//$this->setWhere( "(status = 1 OR status = 2) AND del_flg = 0 ");
$regdate_col = 'dtb_customer.update_date';
if($mode == "magazine") {
$this->setWhere("(del_flg = 0 OR del_flg IS NULL)");
$regdate_col = 'dtb_customer.create_date';
if (!isset ($this->arrSql['customer_id'])) $this->arrSql['customer_id'] = "";
if (!isset ($this->arrSql['name'])) $this->arrSql['name'] = "";
$this->setWhere("(name01 || name02 LIKE ?)" );
}elseif(DB_TYPE == "mysql"){
$this->setWhere("concat(name01,name02) LIKE ?" );
$this->arrVal[] = mb_ereg_replace("[ ]+","",$searchName);
if (!isset ($this->arrSql['kana'])) $this->arrSql['kana'] = "";
$this->setWhere("(kana01 || kana02 LIKE ?)");
}elseif(DB_TYPE == "mysql"){
$this->setWhere("concat(kana01,kana02) LIKE ?" );
$this->arrVal[] = mb_ereg_replace("[ ]+","",$searchKana);
if (!isset ($this->arrSql['pref'])) $this->arrSql['pref'] = "";
if (!isset ($this->arrSql['tel'])) $this->arrSql['tel'] = "";
$this->setWhere( "(tel01 || tel02 || tel03 LIKE ?)" );
}elseif(DB_TYPE == "mysql"){
$this->setWhere("concat(tel01,tel02,tel03) LIKE ?" );
if (!isset ($this->arrSql['sex'])) $this->arrSql['sex'] = "";
foreach ($arrSexVal as $data) {
if (!isset ($this->arrSql['job'])) $this->arrSql['job'] = "";
foreach ($arrJobVal as $data) {
if (!isset ($this->arrSql['email'])) $this->arrSql['email'] = "";
foreach($this->arrSql['email'] as $val) {
if($this->arrSql['not_emailinc'] == '1') {
$sql_where .= "dtb_customer.email NOT ILIKE ? ";
$sql_where .= "AND dtb_customer.email NOT ILIKE ? ";
$sql_where .= "dtb_customer.email ILIKE ? ";
$sql_where .= "OR dtb_customer.email ILIKE ? ";
$this->arrVal[] = $searchEmail;
if (!isset ($this->arrSql['email_mobile'])) $this->arrSql['email_mobile'] = "";
foreach($this->arrSql['email_mobile'] as $val) {
if($this->arrSql['not_email_mobileinc'] == '1') {
$sql_where .= "dtb_customer.email_mobile NOT ILIKE ? ";
$sql_where .= "AND dtb_customer.email_mobile NOT ILIKE ? ";
$sql_where .= "dtb_customer.email_mobile ILIKE ? ";
$sql_where .= "OR dtb_customer.email_mobile ILIKE ? ";
$this->arrVal[] = $searchemail_mobile;
if ( $mode == 'magazine' ){
if (!isset ($this->arrSql['mail_type'])) $this->arrSql['mail_type'] = "";
foreach($arrMobileDomain as $mobile_domain) {
$this->setWhere(" dtb_customer.email NOT ILIKE '%$mobile_domain' ");
$this->setWhere( " dtb_customer.email_mobile <> '' ");
if ( $mode == 'magazine' ){
if (!isset ($this->arrSql['htmlmail'])) $this->arrSql['htmlmail'] = "";
$this->setWhere( " (mailmaga_flg = 1 or mailmaga_flg = 2) ");
if (!isset ($this->arrSql['buy_total_from'])) $this->arrSql['buy_total_from'] = "";
if (!isset ($this->arrSql['buy_total_to'])) $this->arrSql['buy_total_to'] = "";
foreach ($arrBuyTotal as $data1) {
if (!isset ($this->arrSql['buy_times_from'])) $this->arrSql['buy_times_from'] = "";
if (!isset ($this->arrSql['buy_times_to'])) $this->arrSql['buy_times_to'] = "";
foreach ($arrBuyTimes as $data2) {
if (!isset ($this->arrSql['b_start_year'])) $this->arrSql['b_start_year'] = "";
if (!isset ($this->arrSql['b_start_month'])) $this->arrSql['b_start_month'] = "";
if (!isset ($this->arrSql['b_start_day'])) $this->arrSql['b_start_day'] = "";
if (!isset ($this->arrSql['b_end_year'])) $this->arrSql['b_end_year'] = "";
if (!isset ($this->arrSql['b_end_month'])) $this->arrSql['b_end_month'] = "";
if (!isset ($this->arrSql['b_end_day'])) $this->arrSql['b_end_day'] = "";
, $this->arrSql['b_end_year'], $this->arrSql['b_end_month'], $this->arrSql['b_end_day'], "birth");
foreach ($arrBirth as $data3) {
if (!isset ($this->arrSql['birth_month'])) $this->arrSql['birth_month'] = "";
$this->setWhere(" EXTRACT(month from birth) = ?");
if (!isset ($this->arrSql['start_year'])) $this->arrSql['start_year'] = "";
if (!isset ($this->arrSql['start_month'])) $this->arrSql['start_month'] = "";
if (!isset ($this->arrSql['start_day'])) $this->arrSql['start_day'] = "";
if (!isset ($this->arrSql['end_year'])) $this->arrSql['end_year'] = "";
if (!isset ($this->arrSql['end_month'])) $this->arrSql['end_month'] = "";
if (!isset ($this->arrSql['end_day'])) $this->arrSql['end_day'] = "";
, $this->arrSql['end_year'], $this->arrSql['end_month'], $this->arrSql['end_day'], $regdate_col);
foreach ($arrRegistTime as $data4) {
if (!isset ($this->arrSql['buy_start_year'])) $this->arrSql['buy_start_year'] = "";
if (!isset ($this->arrSql['buy_start_month'])) $this->arrSql['buy_start_month'] = "";
if (!isset ($this->arrSql['buy_start_day'])) $this->arrSql['buy_start_day'] = "";
if (!isset ($this->arrSql['buy_end_year'])) $this->arrSql['buy_end_year'] = "";
if (!isset ($this->arrSql['buy_end_month'])) $this->arrSql['buy_end_month'] = "";
if (!isset ($this->arrSql['buy_end_day'])) $this->arrSql['buy_end_day'] = "";
, $this->arrSql['buy_end_year'], $this->arrSql['buy_end_month'], $this->arrSql['buy_end_day'], "last_buy_date");
foreach ($arrRegistTime as $data4) {
if (!isset ($this->arrSql['buy_product_code'])) $this->arrSql['buy_product_code'] = "";
$this->setWhere( "customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_code LIKE ? ))");
$this->arrVal[] = $search_buyproduct_code;
if (!isset ($this->arrSql['buy_product_name'])) $this->arrSql['buy_product_name'] = "";
$this->setWhere( "customer_id IN (SELECT customer_id FROM dtb_order WHERE order_id IN (SELECT order_id FROM dtb_order_detail WHERE product_name LIKE ? ))");
$this->arrVal[] = $search_buyproduct_name;
//カテゴリーを選択している場合のみ絞込検索を行う
if (!isset ($this->arrSql['category_id'])) $this->arrSql['category_id'] = "";
list ($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere(SC_Utils_Ex::sfManualEscape($this->arrSql['category_id']));
$this->setWhere( " customer_id IN (SELECT distinct customer_id FROM dtb_order WHERE order_id IN (SELECT distinct order_id FROM dtb_order_detail WHERE product_id IN (SELECT product_id FROM dtb_product_categories WHERE ". $tmp_where. " ))) ");
if (!isset ($this->arrSql['cell'])) $this->arrSql['cell'] = "";
$this->setWhere( "(cell01 || cell02 || cell03 LIKE ?)" );
if (!isset ($this->arrSql['campaign_id'])) $this->arrSql['campaign_id'] = "";
$this->setWhere( " customer_id IN (SELECT distinct customer_id FROM dtb_campaign_order WHERE campaign_id = ?)" );
if (!isset ($this->arrSql['status'])) $this->arrSql['status'] = "";
foreach ($arrStatusVal as $data) {
$this->select = "SELECT customer_id,name01,name02,kana01,kana02,sex,email,tel01,tel02,tel03,pref,status FROM dtb_customer ";
$email_column = "dtb_customer.email_mobile as email";
$email_column = "dtb_customer.email";
$column = "dtb_customer.customer_id,
dtb_customer.create_date,
dtb_customer.mailmaga_flg";
$this->select = "SELECT COUNT(customer_id) FROM dtb_customer ";
if ($i != 0) $state .= ", ";
$this->select = "SELECT " . $state. " FROM dtb_customer ";
Documentation generated on Fri, 24 Feb 2012 14:00:03 +0900 by Seasoft
|